package Test03;

import java.util.Objects;
import java.util.Scanner;

/**
 * @Author: Re
 * @Date: 2020/11/30 22:24
 */
public class Student {
    String StdName;
    int test1;
    int test2;
    int test3;
    private int StdId;
    private int StdAge;

    public Student(String stdName) {
        StdName = stdName;
    }

    public Student(String stdName, int test1, int test2, int test3) {
        StdName = stdName;
        this.test1 = test1;
        this.test2 = test2;
        this.test3 = test3;
    }

    public void setStdAge(int stdAge) {
        if(stdAge<0){
            System.out.println("还没出生呢？");
            return ;
        }
        StdAge = stdAge;
    }

    public int getStdAge() {
        return StdAge;
    }

    public void setStdId(int stdId) {

        if(stdId<0){
            System.out.println("还没出生呢？");
            return ;
        }
        StdId = stdId;
    }

    public int getStdId() {
        return StdId;
    }

    public void setScore(int i) {
        if(i==1) {
            Scanner scanner=new Scanner(System.in);
            this.test1 =scanner.nextInt();
        }
        if(i==2) {
            Scanner scanner=new Scanner(System.in);
            this.test2 =scanner.nextInt();
        }
        if(i==3) {
            Scanner scanner=new Scanner(System.in);
            this.test3 =scanner.nextInt();
        }
    }
    public int getAverage(){
        return (test1+test2+test3)/3;
    }

    public String getStdName() {
        return "Name:"+StdName+
                ",Age:"+ this.StdAge+
                ",id:"+this.StdId+
                ",Average"+ this.getAverage();
    }

    public void setStdName(String stdName) {
        StdName = stdName;
    }

    public Student compare(Student st){
        if(this.StdAge>st.StdAge){
            System.out.println(this.StdName+" is older");
            return this;
        }else{
            System.out.println(st.StdName+" is older");
            return st;
        }
    }

}

